import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import "lib-flexible"
// import vant from 'vant';
// import 'vant/lib/index.css';
import { Tabbar, TabbarItem, Swipe, SwipeItem, Lazyload, Icon, NavBar, DropdownMenu, DropdownItem, Button, Cell, Grid, GridItem, Tab, Tabs, Search, Toast, PullRefresh, Popup ,Form ,Field 
,ActionSheet ,Area ,DatetimePicker ,Uploader ,Calendar  } from "vant"


Vue.config.productionTip = false

Vue.use(Tabbar);
Vue.use(TabbarItem);
Vue.use(Swipe);
Vue.use(SwipeItem);
Vue.use(Lazyload);
Vue.use(Icon);
Vue.use(NavBar);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);
Vue.use(Button);
Vue.use(Cell);
Vue.use(Grid);
Vue.use(GridItem);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(Search);
Vue.use(Toast);
Vue.use(PullRefresh);
Vue.use(Popup);
Vue.use(Form);
Vue.use(Field);
Vue.use(ActionSheet);
Vue.use(Area);
Vue.use(DatetimePicker);
Vue.use(Uploader);
Vue.use(Calendar);

router.beforeEach((to,form,next)=>{
  const tk = localStorage.getItem('token')
  if(to.path=='/my'){
    if(tk){
      next()
    }else{
      next('/login')
    }
  }else{
    next()
  }
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
